function x = Ainverse(A,n)
%Ainverse 求A逆
%   利用三角分解求逆
L = zeros(n);
U = zeros(n);
A = nLUDecom(A,n);
for i=1:n
    for j=1:n
        if i > j
            U(i,j) = A(i,j);
        else
            L(i,j) = A(i,j);   
        end
    end
    L(i,i) = 1;
end
L = Linverse(L);
U = (Linverse(U'))';
A = U*L;
x = A;
end

